package academic.ui.client.gin;

import academic.ui.client.place.AppPlaceManager;
import academic.ui.client.place.DefaultPlace;
import academic.ui.client.place.Tokens;
import academic.ui.client.presenter.BuyAsGiftPresenter;
import academic.ui.client.presenter.CardPresenter;
import academic.ui.client.presenter.CreateEventPresenter;
import academic.ui.client.presenter.GamePlacePresenter;
import academic.ui.client.presenter.GamePresenter;
import academic.ui.client.presenter.LoginPresenter;
import academic.ui.client.presenter.AccountPresenter;
import academic.ui.client.presenter.MyAccountPresenter;
import academic.ui.client.presenter.MyDealsPresenter;
import academic.ui.client.presenter.MyGroupsPresenter;
import academic.ui.client.presenter.MyProfilePresenter;
import academic.ui.client.presenter.ProductPresenter;
import academic.ui.client.presenter.AppPresenter;
import academic.ui.client.presenter.PrimaryPresenter;
import academic.ui.client.presenter.PrimaryPlacePresenter;
import academic.ui.client.presenter.ProductPlacePresenter;
import academic.ui.client.presenter.CheckoutPresenter;
import academic.ui.client.presenter.ReceiptPresenter;
import academic.ui.client.presenter.RecentDealsPresenter;

import academic.ui.client.view.BuyAsGiftView;
import academic.ui.client.view.CardView;
import academic.ui.client.view.CreateEventView;
import academic.ui.client.view.GamePlaceHolder;
import academic.ui.client.view.GameView;
import academic.ui.client.view.LoginView;
import academic.ui.client.view.AccountView;
import academic.ui.client.view.MyAccountView;
import academic.ui.client.view.MyDealsView;
import academic.ui.client.view.MyGroupsView;
import academic.ui.client.view.MyProfileView;
import academic.ui.client.view.ProductPlaceHolder;
import academic.ui.client.view.ProductView;
import academic.ui.client.view.PrimaryView;
import academic.ui.client.view.AppView;
import academic.ui.client.view.PrimaryPlaceHolder;
import academic.ui.client.view.CheckoutView;
import academic.ui.client.view.ReceiptView;
import academic.ui.client.view.RecentDealsView;

import com.google.inject.Singleton;
import com.gwtplatform.mvp.client.DefaultEventBus;
import com.gwtplatform.mvp.client.DefaultProxyFailureHandler;
import com.gwtplatform.mvp.client.EventBus;
import com.gwtplatform.mvp.client.RootPresenter;
import com.gwtplatform.mvp.client.gin.AbstractPresenterModule;
import com.gwtplatform.mvp.client.proxy.ParameterTokenFormatter;
import com.gwtplatform.mvp.client.proxy.PlaceManager;
import com.gwtplatform.mvp.client.proxy.ProxyFailureHandler;
import com.gwtplatform.mvp.client.proxy.TokenFormatter;

public class RevealClientModule extends AbstractPresenterModule {

	
	@Override
	protected void configure() {
		bind(EventBus.class).to(DefaultEventBus.class).in(Singleton.class);
		bind(PlaceManager.class).to(AppPlaceManager.class).in(Singleton.class);
	    bind(TokenFormatter.class).to(ParameterTokenFormatter.class).in(Singleton.class);
	    bind(RootPresenter.class).asEagerSingleton();
	    bind(ProxyFailureHandler.class).to(DefaultProxyFailureHandler.class).in(Singleton.class);
	    bindConstant().annotatedWith(DefaultPlace.class).to( Tokens.primary	 );
	    bindPresenter(AppPresenter.class,AppPresenter.MyView.class,AppView.class,AppPresenter.MyProxy.class);
	    bindPresenter(PrimaryPresenter.class,PrimaryPresenter.MyView.class,PrimaryView.class,PrimaryPresenter.MyProxy.class);
	    bindPresenter(PrimaryPlacePresenter.class,PrimaryPlacePresenter.MyView.class,PrimaryPlaceHolder.class,PrimaryPlacePresenter.MyProxy.class);
	    bindPresenter(ProductPlacePresenter.class,ProductPlacePresenter.MyView.class,ProductPlaceHolder.class,ProductPlacePresenter.MyProxy.class);
	    bindPresenter(CheckoutPresenter.class,CheckoutPresenter.MyView.class,CheckoutView.class,CheckoutPresenter.MyProxy.class);
	    bindPresenter(ProductPresenter.class,ProductPresenter.MyView.class,ProductView.class,ProductPresenter.MyProxy.class);
	    bindPresenter(LoginPresenter.class,LoginPresenter.MyView.class,LoginView.class,LoginPresenter.MyProxy.class);
	    bindPresenter(BuyAsGiftPresenter.class,BuyAsGiftPresenter.MyView.class,BuyAsGiftView.class,BuyAsGiftPresenter.MyProxy.class);
	    bindPresenter(CreateEventPresenter.class,CreateEventPresenter.MyView.class,CreateEventView.class,CreateEventPresenter.MyProxy.class);
	    bindPresenter(AccountPresenter.class,AccountPresenter.MyView.class,AccountView.class,AccountPresenter.MyProxy.class);
	    bindPresenter(GamePresenter.class,GamePresenter.MyView.class,GameView.class,GamePresenter.MyProxy.class);
	    bindPresenter(GamePlacePresenter.class,GamePlacePresenter.MyView.class,GamePlaceHolder.class,GamePlacePresenter.MyProxy.class);
	    bindPresenter(RecentDealsPresenter.class,RecentDealsPresenter.MyView.class,RecentDealsView.class,RecentDealsPresenter.MyProxy.class);
        bindPresenter(ReceiptPresenter.class, ReceiptPresenter.MyView.class, ReceiptView.class, ReceiptPresenter.MyProxy.class);
        bindSingletonPresenterWidget(CardPresenter.class, CardPresenter.MyView.class, CardView.class);
        bindSingletonPresenterWidget(MyDealsPresenter.class, MyDealsPresenter.MyView.class, MyDealsView.class);
        bindSingletonPresenterWidget(MyProfilePresenter.class, MyProfilePresenter.MyView.class, MyProfileView.class);
        bindSingletonPresenterWidget(MyGroupsPresenter.class, MyGroupsPresenter.MyView.class, MyGroupsView.class);
        bindSingletonPresenterWidget(MyAccountPresenter.class, MyAccountPresenter.MyView.class, MyAccountView.class);
	}

}
